package com.aaa.dao;

import com.aaa.entity.Emp;
import com.aaa.entity.Massage;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;

@Component
public interface S_LoginDao {
    /*@Select("select * from emp where username=#{username} and password=#{password}")
    List<Emp> login(Emp emp);*/

    @Select(" SELECT  a.id,a.`name`,a.unituser,a.`password`,a.number,a.email,a.linkman,a.linknum,a.address,a.introduce,a.state,a.SHtime,a.SHuser, "
            + "  b.manage,c.type,d.nature,e.industry,f.grading  "
            + "  FROM regist a "
            + "  JOIN manage_unit b on a.manage=b.id"
            + "  JOIN unit_type c on a.type=c.id"
            + "  JOIN unit_nature d on a.nature=d.id"
            + "  JOIN industry e ON a.industry=e.id"
            + "  JOIN grading f on a.grading=f.id  where  a.unituser=#{username} and  a.`password`=#{password}")
    Massage session(Map map);


    @Select("select * from emp where username=#{username} and password=#{password} and state='正常'")
    List<Emp> login(Map map1);

    @Select("SELECT * FROM(SELECT  a.id,a.deptid,a.roleid,a.ename,a.username,a.`password`,a.dizhi,b.manage ,c.`name` empname  from emp a,manage_unit b,role c where a.deptid=b.id and c.id=a.roleid   and a.username=#{username} AND a.`password`=#{password}) p")
    Emp selectEmp(Map map1);
}
